package com.game_info.service.impl;

import java.util.List;

import com.game_info.mapper.UsersMapper;
import com.game_info.service.UsersService;
import com.game_info.vo.Users;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Users表Service业务层处理
 *
 * @author ttj
 * @date 2020-04-14
 */
@Service
public class UsersServiceImpl implements UsersService {
    @Autowired
    private UsersMapper usersMapper;

    /**
     * 根据id查询单个用户
     *
     * @param uId
     * @return Users
     */
    @Override
    public Users selectUsersById(Integer uId) {
        return usersMapper.selectUsersById(uId);
    }

    /**
     * 查询用户列表
     *
     * @param users
     * @return Users列表
     */
    @Override
    public List<Users> selectUsersList(Users users) {
        return usersMapper.selectUsersList(users);
    }

    /**
     * 根据用户名查找用户信息
     * @param uName
     * @return
     */
    public Users selectUserByName(String uName){
        return usersMapper.selectUserByName(uName);
    }

    /**
     * 根据用户名和密码查询用户是否存在
     *
     * @param uName
     * @param uPwd
     * @return 查询结果
     */
    @Override
    public Integer selectUserByIdOrName(String uName, String uPwd) {
            return usersMapper.selectUserByIdOrName(uName,uPwd);
    }

    /**
     * 分页查询
     *
     * @param pagesSize
     * @param startPages
     * @return
     */
    @Override
    public List<Users> selectUsersLimit(Integer startPages, Integer pagesSize) {
        return usersMapper.selectUsersLimit(startPages,pagesSize);
    }

    /**
     * 获取全部用户总数
     *
     * @return
     */
    @Override
    public Integer getUsersCount() {
        return usersMapper.getUsersCount();
    }

    /**
     * 根据关键词模糊查询全部字段信息
     *
     * @param keyword
     * @return
     */
    @Override
    public List<Users> selectLikeKeyword(String keyword) {
        return usersMapper.selectLikeKeyword(keyword);
    }

    /**
     * 新增
     *
     * @param users
     * @return 结果
     */
    @Override
    public int insertUsers(Users users) {
        return usersMapper.insertUsers(users);
    }

    /**
     * 修改
     *
     * @param users
     * @return 结果
     */
    @Override
    public int updateUsers(Users users) {
        return usersMapper.updateUsers(users);
    }

    /**
     * 批量删除
     *
     * @param ids 需要删除的uid字符串
     * @return 结果
     */
    @Override
    public int deleteUsersByIds(String ids) {
        return usersMapper.deleteUsersByIds(ids.split(""));
    }

    /**
     * 删除单个信息
     *
     * @param uId 【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteUsersById(Integer uId) {
        return usersMapper.deleteUsersById(uId);
    }
}
